﻿<?php
session_start();
if(isset($_SESSION["admin"])){
}else{
	echo "<script>window.location.href='login/index.html';</script>";
	exit();
}
include_once '../conn/mysql.php';
if(isset($_GET['oper'])){
	$oper=$_GET['oper'];
}else {
	$oper='';
}
if($oper=='admin_chang') {
	$old_pwd=$_POST['old_pwd'];
	$new_pwd=$_POST['new_pwd'];
	$res=sql('s','admin',"*","");
	$res=firstrow($res);
	if (gv($res,"pwd")==md5($old_pwd)) {
		$admin=gv($res,"user");
		$mipwd=md5($new_pwd);
		$data = array(
			"pwd" => "$mipwd"
	);
	$res=sql('u','admin',$data,"");
		require  './user/pwd.php';
		echo "<script>alert('密码修改成功'); history.back();</script>";
	}else{
		echo "<script>alert('原始密码不正确'); history.back();</script>";
	}
}elseif($oper=='product_del'){
	$id=$_GET['id'];
	$res=sql('d','product',"","where id=".$id);
	echo "<script>alert('删除成功');window.location.href='content/product.php';</script>";
}elseif($oper=='product_add'){
	$suk="";
	$cb="";
	$jg="";
	$fc="";
for($i=1;$i<=8;$i++){
		if (!$_POST['suk'.$i]=='') {
			$suk=$suk."-|-".$_POST['suk'.$i];
	$cb=$cb."-|-".$_POST['cb'.$i];
	$jg=$jg."-|-".$_POST['jg'.$i];
	$fc=$fc."-|-".$_POST['fc'.$i];
		}
}
	$data=array(
			'order1'=>$_POST['order'],
			'name'=>$_POST['name'],
			'sh'=>$_POST['sh'],
			'qq'=>$_POST['qq'],
			'wx'=>$_POST['wx'],
			'tgsm'=>$_POST['tgsm'],
			'sptu'=>$_POST['imgurl'],
			'cb'=>$cb,
			'suk'=>$suk,
			'jg'=>$jg,
			'fc'=>$fc,
			'title'=>$_POST['title'],
			'wasm'=>$_POST['wasm'],
			'url'=>$_POST['url'],
			'prurl'=>$_POST['prurl']
			);
	if(isset($_GET['id'])){
				$res=sql('u','product',$data,"where id=".$_GET['id']);
				
		}else{
				$res=sql('i','product',$data,"");
			}

	echo "<script>alert('修改成功'); window.location.href='content/product.php';</script>";
}elseif($oper=='fahuo'){
	$id=$_GET['id'];
	$data=array(
			'kd'=>$_POST['kd'],
			'dh'=>$_POST['dh'],
			'beizhu'=>$_POST['beizhu'],
			'zt'=>"2",
			'fh_time'=>date("Y-m-d H-i-s")
			);
	$res=sql('u','list',$data,"where id=".$id);
	echo "<script>alert('已发货！'); window.location.href='content/list.php?zt=2';</script>";
}elseif($oper=='edit_bei'){
	$id=$_GET['id'];
	$data=array(
			'beizhu'=>$_POST['beizhu']
			);
	$res=sql('u','list',$data,"where id=".$id);
	echo "<script>alert('修改成功！'); window.location.href='content/list.php?zt=3';</script>";
}elseif($oper=='tuihuo'){
	$id=$_GET['id'];
	$data=array(
			'th_name'=>$_POST['th_name'],
			'th_tel'=>$_POST['th_tel'],
			'th_dz'=>$_POST['th_dz'],
			'zt'=>"5",
			'th_time'=>date("Y-m-d H-i-s")
			);
	$res=sql('u','list',$data,"where id=".$id);
	echo "<script>alert('已同意退货！'); history.back();</script>";
}elseif($oper=='wanchengtuihuo'){
	$id=$_GET['id'];
	$data=array(
			'zt'=>"6"
			);
	$res=sql('u','list',$data,"where id=".$id);
	echo "<script>alert('退货已确认！'); history.back();</script>";
}elseif($oper=='tuikuan'){
	$id=$_GET['id'];
	$res1=sql('s','list',"*","where id=".$id);
	$info1=firstrow($res1);
	$data=array(
			"list_id"=>$id,
			"sm"=>$_POST['sm'],
			"money"=>$_POST["money"],
			"yongjin"=>$_POST["yongjin"],
			"tjr"=>gv($info1,"tjr"),
			"time"=>date("Y-m-d")
			);
	$res=sql('i','yichang',$data,"");
	$data=array(
			"zt"=>'6'
	);
	$res=sql('u','list',$data,"where id=".$id);
	echo "<script>alert('退货已确认！');window.location.href='content/list.php?zt=6';</script>";
}elseif($oper=='jiesuan'){
	$id=$_GET['id'];
	$data=array(
			'zt'=>"3"
			);
	$res=sql('u','list',$data,"where id=".$id);
	$res1=sql('s','list',"*","where id=".$id);
	$info1=firstrow($res1);
	$res=sql('s','qs_list',"*","where tjr='".gv($info1,"tjr")."'  and zt='3'");
	if($res){
		$info=firstrow($res);
		$data=array(
				"fc"=>gv($info1,"fc")+gv($info,"fc"),
				"jg"=>gv($info1,"jg")+gv($info,"jg"),
				"qs_time"=>date("Y-m-d"),
				"num"=>gv($info,"num")+1
				);
		$res=sql('u','qs_list',$data,"where tjr='".gv($info1,"tjr")."'  and zt='3'");
	}else{
		$data=array(
				"tjr"=>gv($info1,"tjr"),
				"qs_time"=>date("Y-m-d"),
				"fc"=>gv($info1,"fc"),
				"jg"=>gv($info1,"jg"),
				"num"=>'1',
				"zt"=>'3'
		);
		$res=sql('i','qs_list',$data,"");
	}
	echo "<script>alert('确认已结算！'); window.location.href='content/list.php?zt=3';</script>";
}elseif($oper=='jushou'){
	$id=$_GET['id'];
	$data=array(
			'zt'=>"7"
			);
	$res=sql('u','list',$data,"where id=".$id);
	echo "<script>alert('已拒收！'); window.location.href='content/list.php?zt=7';</script>";
}elseif($oper=='jiangli'){
	$id=$_GET['id'];
	$data=array(
			'shangjiafan'=>"1"
			);
	$res=sql('u','list',$data,"where id=".$id);
	echo "<script>alert('已奖励！'); window.location.href='content/jiangli.php';</script>";
}elseif($oper=='fankuan'){
	$id=$_GET['id'];
	$data=array(
			'zt'=>"8"
			);
	$res=sql('u','list',$data,"where id=".$id);
	$res1=sql('s','list',"*","where id=".$id);
	$info1=firstrow($res1);
	$res=sql('s','qs_list',"*","where tjr='".gv($info1,"tjr")."' and qs_time='".date("Y-m-d")."' and zt='8'");
	if($res){
		$info=firstrow($res);
		$data=array(
				"fc"=>gv($info1,"fc")+gv($info,"fc"),
				"jg"=>gv($info1,"jg")+gv($info,"jg"),
				"num"=>gv($info,"num")+1
		);
		$res=sql('u','qs_list',$data,"where tjr='".gv($info1,"tjr")."' and qs_time='".date("Y-m-d")."' and zt='8'");
	}else{
		$data=array(
				"tjr"=>gv($info1,"tjr"),
				"qs_time"=>date("Y-m-d"),
				"fc"=>gv($info1,"fc"),
				"jg"=>gv($info1,"jg"),
				"num"=>'1',
				"zt"=>'8'
		);
		$res=sql('i','qs_list',$data,"");
	}
	$res=sql('s','qs_list',"*","where tjr='".gv($info1,"tjr")."'  and zt='3'");
		$info=firstrow($res);
		$data=array(
				"fc"=>gv($info,"fc")-gv($info1,"fc"),
				"jg"=>gv($info,"jg")-gv($info1,"jg"),
				"qs_time"=>date("Y-m-d"),
				"num"=>gv($info,"num")-1
		);
		$res=sql('u','qs_list',$data,"where tjr='".gv($info1,"tjr")."'  and zt='3'");
	echo "<script>alert('确认已返款！'); window.location.href='content/list.php?zt=8';</script>";
}elseif($oper=='user_pwd'){
	$id=$_GET['id'];
	$string = 'abcdefghijklmnopgrstuvwxyz0123456789';
	$rand = '';
	for($i=1;$i<7;$i++){
	$rand .= substr($string,mt_rand(0,strlen($string)-1),1);
	}
	$data=array(
			'pwd'=>md5($rand)
			);
	$res=sql('u','user',$data,"where id=".$id);
	echo "<script>alert('密码：".$rand."'); history.back();</script>";
}elseif($oper=='user_del'){
	$id=$_GET['id'];
	$string = 'abcdefghijklmnopgrstuvwxyz0123456789';
	$res=sql('d','user',"","where id=".$id);
	echo "<script>alert('删除成功'); history.back();</script>";
}elseif($oper=='list_del'){
	$id=$_GET['id'];
	$res=sql('d','list',"","where id=".$id);
	echo "<script>alert('删除成功'); history.back();</script>";
}elseif($oper=='foot'){
	$data=array(
			'qq'=>$_POST['qq'],
			'tel'=>$_POST['tel'],
			'title'=>$_POST['title'],
			'zhuce'=>$_POST['zhuce'],
			'qun'=>$_POST['qun'],
			'nc1'=>$_POST['nc1'],
			'qq1'=>$_POST['qq1'],
			'nc2'=>$_POST['nc2'],
			'qq2'=>$_POST['qq2'],
			'nc3'=>$_POST['nc3'],
	'copyright'=>$_POST['copyright'],
			'qq3'=>$_POST['qq3']
	);
	$res=sql('u','home',$data,"");
	echo "<script>alert('修改成功'); history.back();</script>";
}elseif($oper=='user_add'){
	$id=$_GET['id'];
	$data=array(
			'qq'=>$_POST['qq'],
			'tel'=>$_POST['tel'],
			'email'=>$_POST['email'],
			'zhifubao'=>$_POST['zhifubao'],
			'xingming'=>$_POST['xingming']
	);
	$res=sql('u','user',$data,"where id='".$id."'");
	echo "<script>alert('修改成功'); history.back();</script>";
}elseif($oper=='destroy') {
		session_destroy();
		echo "<script>window.location.href='/admin/';</script>";
	}




























/*elseif($oper=='foot') {
	$user=$_SESSION["unc"];
	$cprt=$_POST['cprt'];
	$contact=$_POST['contact'];
	$other=$_POST['other'];
	$postcode=$_POST['postcode'];
	$footstate=$_POST['footstate'];
	
	$data = array(
			"copyright" => "$cprt",
			"contact" => "$contact",
			"other" => "$other",
		   "postcode" => "$postcode",
		    "footstate" => "$footstate"
			);

	if($res=sql('u','face',$data,"where user='".$user."'")){
		$res=sql('u','face',$data,"where user='".$user."'");
		echo "<script>alert('信息修改成功'); history.back();</script>";
	}
	}elseif($oper=='face') {
	$user=$_SESSION["unc"];
	$pcmould=$_POST['pcmould'];
	$mmould=$_POST['mmould'];
	$title=$_POST['title'];
	$keyword=$_POST['keyword'];
	$describe=$_POST['describe'];
	$tel=$_POST['tel'];
	$adress=$_POST['adress'];
	$cprt=$_POST['cprt'];
	$data = array(
			"pcmould" => "$pcmould",
			"mmould" => "$mmould",
			"tel" => "$tel",
			"keyword" => "$keyword",
			"title" => "$title",
			"miaoshu" => "$describe",
			"adress" => "$adress",
			"cprt" => "$cprt"
			);
	if($res=sql('u','face',$data,"where user='".$user."'")){
		$res=sql('u','face',$data,"where user='".$user."'");
		echo "<script>alert('信息修改成功'); history.back();</script>";
	}
	}elseif($oper=='colum') {
		$user=$_SESSION["unc"];
		$res=sql('s', 'colum', 'id', "where user='".$user."'");
		foreach ($res as $info){
			$id=$info["id"];
			$user=$_SESSION["unc"];
			$order=$_POST["no_order_$id"];
			$name=$_POST["name_$id"];
			$module=$_POST["module_$id"];
			$isshow=$_POST["nav_$id"];
			$home_order=$_POST["index_num_$id"];
			$right=$_POST["access_$id"];
			$data=array(
			"wed_order"=>"$order",
			"name"=>"$name",
			"module"=>"$module",
			"wed_isshow"=>"$isshow",
			"home_order"=>"$home_order",
			"wed_right"=>"$right"
			);
			$res1=sql('u', 'colum',$data, "where id=".$id);
			
		}
?>
<!--内容begain  -->

<!-- 内容end -->
<?php 
		
		echo "<script>alert('信息修改成功'); history.back(); </script>";
	}elseif($oper=='sys_other') {
	$user=$_SESSION["unc"];
	$tel=$_POST['tel'];
	$qq=$_POST['qq'];
$title=$_POST['title'];
	$qq1=$_POST['qq1'];
	$qq2=$_POST['qq2'];
	$adress=$_POST['adress'];
	$coordinate=$_POST['lonlat'];
	$data = array(
			"tel" => "$tel",
 			"title" => "$title",
			"qq" => "$qq",
			"qq1" => "$qq1",
			"qq2" => "$qq2",
			"adress"=>"$adress",
			"coordinate" => "$coordinate"
			);
	if($res=sql('u','face',$data,"where user='".$user."'")){
		$res=sql('u','face',$data,"where user='".$user."'");
		echo "<script>alert('信息修改成功'); history.back();</script>";
	}
	}elseif($oper=='column_editor') {
	$user=$_SESSION["unc"];
	$id=$_GET['id'];
	$order=$_POST["no_order"];
	$name=$_POST["name"];
	$isshow=$_POST["nav"];
	$home_order=$_POST["index_num"];
	$right=$_POST["access"];
	$module=$_POST["module"];
	$keywords=$_POST["keywords"];
	$description=$_POST["description"];
	$data=array(
			"wed_order"=>"$order",
			"name"=>"$name",
			"wed_isshow"=>"$isshow",
			"home_order"=>"$home_order",
			"wed_right"=>"$right",
			"module"=>"$module",
			"keywords"=>"$keywords",
			"description"=>"$description"
	);
	$res1=sql('u', 'colum',$data, "where id=".$id);
	echo "<script>alert('信息修改成功'); history.back(); </script>";
	}elseif($oper=='column_del') {
	$user=$_SESSION["unc"];
	$id=$_GET['id'];
	
	$res1=sql('d', 'colum',"", "where id=".$id);
	echo "<script>alert('信息修改成功'); history.back(); </script>";
	}elseif($oper=='mould') {
	$user=$_SESSION["unc"];
	$pc=$_POST["pc"];
	$phone=$_POST["phone"];
	$data=array(
			"pcmould"=>"$pc",
			"mmould"=>"$phone",
	);
	$res1=sql('u', 'face',$data, "where user='".$user."'");
	echo "<script>alert('信息修改成功'); history.back(); </script>";
	}elseif($oper=='article') {
	$user=$_SESSION["unc"];
	$class=$_GET['class'];
	$title=$_POST["title"];
	$imgurl=$_POST["imgurl"];
	$keyword=$_POST["keyword"];
	$description=$_POST["description"];
	$content=$_POST["content"];
	$content=str_replace('src="/editor/', 'src="http://web.lovevi.cn/editor/', $content);
	
	$time=date("Y-m-d H-i-s");
	$data=array(
			"user"=>$user,
			"class"=>$class,
			"title"=>$title,
			"imgurl"=>$imgurl,
			"keyword"=>$keyword,
			"description"=>$description,
			"content"=>$content,
			"time"=>$time
	);
	$num=sql('frow', 'article',"*", "where user='".$user."' and class=".$class);
	if ($num!=1) {
		$res1=sql('i', 'article',$data, "");
	}else{
		$res1=sql('u', 'article',$data, "where class=".$class);
	}
	echo "<script>alert('信息修改成功'); history.back(); </script>";
	}elseif($oper=='article_tab') {
	$user=$_SESSION["unc"];
	$class=$_GET['class'];
	$order=$_POST["order"];
	$top=$_POST["top"];
	$recommend=$_POST["recommend"];
	$title=$_POST["title"];
	$imgurl=$_POST["imgurl"];
	$keyword=$_POST["keyword"];
	$description=$_POST["description"];
	$content=$_POST["content"];
$content=str_replace('src="/editor/', 'src="http://web.lovevi.cn/editor/', $content);
	
	$time=date("Y-m-d H-i-s");
	$data=array(
			"user"=>$user,
			"class"=>$class,
			"title"=>$title,
			"recommend"=>$recommend,
			"order_int"=>$order,
			"top"=>$top,
			"imgurl"=>$imgurl,
			"keyword"=>$keyword,
			"description"=>$description,
			"content"=>$content,
			"time"=>$time
	);
	if (isset($_GET['id'])) {
		$res1=sql('u', 'article_tab',$data, "where id=".$_GET['id']);
	}else{
		$res1=sql('i', 'article_tab',$data, "");
	}
	echo "<script>alert('信息修改成功'); history.back(); </script>";
	}elseif($oper=='article_tab_del') {
		$user=$_SESSION["unc"];
		$id=$_GET['id'];
		$class=$_GET['class'];
		$res1=sql('d', 'article_tab',"", "where id=".$_GET['id']);
		echo "<script>alert('删除成功');window.location.href='content/article_tab_edit.php?class=".$class."';</script>";
	}elseif($oper=='video') {
	$user=$_SESSION["unc"];
	$class=$_GET['class'];
	$order=$_POST["order"];
	$top=$_POST["top"];
	$recommend=$_POST["recommend"];
	$title=$_POST["title"];
	$imgurl=$_POST["imgurl"];
	$keyword=$_POST["keyword"];
	$description=$_POST["description"];
	$videourl=$_POST["videourl"];
	$time=date("Y-m-d H-i-s");
	$data=array(
			"user"=>$user,
			"class"=>$class,
			"title"=>$title,
			"recommend"=>$recommend,
			"order_int"=>$order,
			"top"=>$top,
			"imgurl"=>$imgurl,
			"keyword"=>$keyword,
			"description"=>$description,
			"videourl"=>$videourl,
			"time"=>$time
	);
	if (isset($_GET['id'])) {
		$res1=sql('u', 'video',$data, "where id=".$_GET['id']);
	}else{
		$res1=sql('i', 'video',$data, "");
	}
	echo "<script>alert('信息修改成功'); history.back(); </script>";
	}elseif($oper=='video_del') {
		$user=$_SESSION["unc"];
		$id=$_GET['id'];
		$class=$_GET['class'];
		$res1=sql('d', 'video',"", "where id=".$_GET['id']);
		echo "<script>alert('删除成功');window.location.href='content/video_edit.php?class=".$class."';</script>";
	}elseif($oper=='img') {
	$user=$_SESSION["unc"];
	$class=$_GET['class'];
	$order=$_POST["order"];
	$top=$_POST["top"];
	$recommend=$_POST["recommend"];
	$title=$_POST["title"];
	$imgurl=$_POST["imgurl"];
	$keyword=$_POST["keyword"];
	$description=$_POST["description"];
	$time=date("Y-m-d H-i-s");
	$data=array(
			"user"=>$user,
			"class"=>$class,
			"title"=>$title,
			"recommend"=>$recommend,
			"order_int"=>$order,
			"top"=>$top,
			"imgurl"=>$imgurl,
			"keyword"=>$keyword,
			"description"=>$description,
			"time"=>$time
	);
	if (isset($_GET['id'])) {
		$res1=sql('u', 'photo',$data, "where id=".$_GET['id']);
		echo "<script>alert('信息保存成功');window.location.href='content/img.php?class=".$class."&id=".$_GET['id']."'; </script>";
	}else{
		$id=$res1=sql('addid', 'photo',$data, "");
		echo "<script>alert('信息保存成功，请上传图片');window.location.href='content/img.php?class=".$class."&id=".$id."'; </script>";
	}

	}elseif($oper=='img_del') {
		$user=$_SESSION["unc"];
		$id=$_GET['id'];
		$class=$_GET['class'];
		$res1=sql('d', 'photo',"", "where id=".$_GET['id']);
		echo "<script>alert('删除成功');window.location.href='content/img_edit.php?class=".$class."';</script>";
	}elseif($oper=='lottery') {
	$user=$_SESSION["unc"];
	$class=$_GET['class'];
	$mould=$_POST['mould'];
	$probability1=$_POST["probability1"];
	$probability2=$_POST["probability2"];
	$probability3=$_POST["probability3"];
	$probability4=$_POST["probability4"];
	$probability5=$_POST["probability5"];
	$probability6=$_POST["probability6"];
	$probability7=$_POST["probability7"];
	$probability8=$_POST["probability8"];
	$content1=$_POST["content1"];
	$content2=$_POST["content2"];
	$content3=$_POST["content3"];
	$content4=$_POST["content4"];
	$content5=$_POST["content5"];
	$content6=$_POST["content6"];
	$content7=$_POST["content7"];
	$content8=$_POST["content8"];
	$time=date("Y-m-d H-i-s");
	$data=array(
			"probability1"=>$probability1,
			"probability2"=>$probability2,
			"probability3"=>$probability3,
			"probability4"=>$probability4,
			"probability5"=>$probability5,
			"probability6"=>$probability6,
			"probability7"=>$probability7,
			"probability8"=>$probability8,
			"content1"=>$content1,
			"content2"=>$content2,
			"content3"=>$content3,
			"content4"=>$content4,
			"content5"=>$content5,
			"content6"=>$content6,
			"content7"=>$content7,
			"content8"=>$content8,
			"mould"=>$mould,
			"class"=>$class,
			"time"=>$time
	);
	$res1=sql('s', 'lottery',"*", "where class=".$class);
	$level=arrayLevel($res1);
	if ($level==1) {
		$res1=sql('u', 'lottery',$data, "where class=".$class);
		echo "<script>alert('信息保存成功');window.location.href='content/lottery.php?class=".$class."'; </script>";
	}else{
		$res1=sql('i', 'lottery',$data, "");
		echo "<script>alert('信息保存成功');window.location.href='content/lottery.php?class=".$class."'; </script>";
	}

	}elseif($oper=='friendly') {
	$user=$_SESSION["unc"];
	$class=$_GET['class'];
	$order=$_POST["order"];
	$title=$_POST["title"];
	$imgurl=$_POST["imgurl"];
	$description=$_POST["description"];
	$url=$_POST["url"];
	$time=date("Y-m-d H-i-s");
	$data=array(
			"user"=>$user,
			"class"=>$class,
			"title"=>$title,
			"order_int"=>$order,
			"imgurl"=>$imgurl,
			"description"=>$description,
			"url"=>$url,
			"time"=>$time
	);
	if (isset($_GET['id'])) {
		$res1=sql('u', 'friendly',$data, "where id=".$_GET['id']);
	}else{
		$res1=sql('i', 'friendly',$data, "");
	}
	echo "<script>alert('信息修改成功'); history.back(); </script>";
	}elseif($oper=='friendly_del') {
		$user=$_SESSION["unc"];
		$id=$_GET['id'];
		$class=$_GET['class'];
		$res1=sql('d', 'friendly',"", "where id=".$_GET['id']);
		echo "<script>alert('删除成功');window.location.href='content/friendly_edit.php?class=".$class."';</script>";
	}elseif($oper=='feedback_del') {
		$user=$_SESSION["unc"];
		
		$id=$_GET['id'];
		sql("d", "leave_msg", "", "where id=".$id);
		echo "<script>alert('删除成功');window.location.href='feedback/feedback.php?user=".$user."';</script>";
	}elseif($oper=='leave_inc') {
		$user=$_SESSION["unc"];
		$class=$_GET['class'];
		if(isset($_POST['leave_show'])){
			$leave_show=$_POST['leave_show'];
		}else{
			$leave_show="0";
		}
		$data=array(
				"leave_show"=>$leave_show,
				"leave_time"=>$_POST['leave_time'],
				"leave_filter"=>$_POST['leave_filter']
				);
		sql("u", "face", $data, "where user='".$user."'");
		echo "<script>alert('修改成功');window.location.href='feedback/leave.php?class=".$class."';</script>";
	}elseif($oper=='leave_edit') {
		$user=$_SESSION["unc"];
		$class=$_GET['class'];
		$id=$_GET['id'];
		$data=array(
				"see"=>$_POST['button']
				);
		$res=sql("u", "leave_msg",$data,"where id=$id");
		
		echo "<script>alert('修改成功');window.location.href='feedback/leave.php?class=".$class."';</script>";
	}elseif($oper=='member_edit') {
		$user=$_SESSION["unc"];
		$id=$_GET['id'];
		
		$data=array(
				"pwd"=>$_POST['pwd'],
				"tel"=>$_POST['tel'],
				"email"=>$_POST['email'],
				"another"=>$_POST['another'],
				"act"=>$_POST['act']
				);
		$res=sql("u", "user",$data,"where id=$id");
		
		echo "<script>alert('修改成功');window.location.href='member/member.php';</script>";
	}elseif($oper=='head_img') {
		$user=$_SESSION["unc"];
		$id=$_GET['id'];
		$res=sql("s", "face", "*", "where user='".$user."'");
		if ($res['main_img']!=''){
		$info=explode('|', $res['main_img']);
		$info1=$info[$id];
		$info[$id]='|'.$info[$id];
		$rs=str_replace($info[$id],"",$res['main_img']);
		$data=array("main_img"=>$rs);
		$res=sql("u", "face",$data, "where user='".$user."'");
		unlink("../uploade/".$info1);
		}
		echo "<script>alert('修改成功');window.location.href='face/head.php';</script>";
	}elseif($oper=='mobile_img') {
		$user=$_SESSION["unc"];
		$id=$_GET['id'];
		$res=sql("s", "face", "*", "where user='".$user."'");
		if ($res['mobile_img']!=''){
		$info=explode('|', $res['mobile_img']);
		$info1=$info[$id];
		$info[$id]='|'.$info[$id];
		$rs=str_replace($info[$id],"",$res['mobile_img']);
		$data=array("mobile_img"=>$rs);
		$res=sql("u", "face",$data, "where user='".$user."'");
		unlink("../uploade/".$info1);
		}
		echo "<script>alert('修改成功');window.location.href='face/mobile.php';</script>";
	}elseif($oper=='img_img') {
		$user=$_SESSION["unc"];
		$id=$_GET['id'];
		$img_id=$_GET['img_id'];
		$res=sql("s", "photo", "*", "where id=".$img_id);
		$class=$res["class"];
		if ($res['img']!=''){
		$info=explode('|', $res['img']);
		$info1=$info[$id];
		$info[$id]='|'.$info[$id];
		$rs=str_replace($info[$id],"",$res['img']);
		$data=array("img"=>$rs);
		$res=sql("u", "photo",$data, "where id=".$img_id);
		unlink("../uploade/".$info1);
		}
		echo "<script>alert('修改成功');window.location.href='content/img.php?id=".$img_id."&class=".$class."';</script>";
	}elseif($oper=='destroy') {
		session_destroy();
		echo "<script>window.location.href='login/index.html';</script>";
	}elseif($oper=='price') {
	$user=$_SESSION["unc"];
	$class=$_GET['class'];
	$order=$_POST["order"];
	$top=$_POST["top"];
	$recommend=$_POST["recommend"];
	$title=$_POST["title"];
	$price=$_POST["price"];
	$imgurl=$_POST["imgurl"];
	$keyword=$_POST["keyword"];
	$description=$_POST["description"];
	$content=$_POST["content"];
$content=str_replace('src="/editor/', 'src="http://web.lovevi.cn/editor/', $content);
	
	$time=date("Y-m-d H-i-s");
	$data=array(
			"user"=>$user,
			"class"=>$class,
			"title"=>$title,
			"price"=>$price,
			"recommend"=>$recommend,
			"order_int"=>$order,
			"top"=>$top,
			"imgurl"=>$imgurl,
			"keyword"=>$keyword,
			"description"=>$description,
			"content"=>$content,
			"time"=>$time
	);
	if (isset($_GET['id'])) {
		$res1=sql('u', 'price',$data, "where id=".$_GET['id']);
	}else{
		$res1=sql('i', 'price',$data, "");
	}
	echo "<script>alert('信息修改成功'); history.back(); </script>";
	}elseif($oper=='price_del') {
		$user=$_SESSION["unc"];
		$id=$_GET['id'];
		$class=$_GET['class'];
		$res1=sql('d', 'price',"", "where id=".$_GET['id']);
		echo "<script>alert('删除成功');window.location.href='content/article_tab_edit.php?class=".$class."';</script>";
	}elseif($oper=='user_pwd') {
		$user=$_SESSION["unc"];
		$id=$_GET['id'];
		$rand=date("His")*rand(0, 100);
		$data=array("pwd"=>$rand);
		$res1=sql('u', 'user',$data, "where id=".$_GET['id']);
		echo "<script>alert('密码初始化成功，初始密码是：".$rand."'); window.location.href='user/user.php?user=".$user."';</script>";
	}elseif($oper=='user_del') {
		$user=$_SESSION["unc"];
		$id=$_GET['id'];
		$res=sql("s", "user", "*","where id=".$_GET['id']);
		$name=$res['user'];
		sql('d', 'message',"", "where user='".$name."'");
		sql('d', 'user',"", "where id=".$_GET['id']);
		echo "<script>alert('删除成功'); window.location.href='user/user.php?user=".$user."';</script>";
	}
	
	
	*/
	
	
	
	
	
